<template>
  <div>
    <div
        :style='{"padding":"12px","boxShadow":"0 0px 6px #999","margin":"0px auto","borderColor":"#fff","borderRadius":"0px","background":"linear-gradient(180deg, #eee 0%, #fff 32%, #eee 100%)","borderWidth":"1px 0 1px 0","width":"100%","borderStyle":"solid"}'
        class="breadcrumb-preview">
      <el-breadcrumb :separator="'Ξ'" :style='{"width":"1200px","margin":"0 auto","fontSize":"14px","lineHeight":"1"}'>
        <el-breadcrumb-item>首页</el-breadcrumb-item>
        <el-breadcrumb-item v-for="(item, index) in breadcrumbItem" :key="index">{{ item.name }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <div class="detail-preview"
         :style='{"width":"1200px","padding":"0 0 24px","margin":"0px auto","position":"relative"}'>
      <div class="attr"
           :style='{"border":"1px solid #dfdfdf","padding":"16px 16px 20px 16px","boxShadow":"1px 2px 3px #eee","margin":"20px 0 20px 0","overflow":"hidden","borderRadius":"16px","background":"#fff","position":"relative"}'>
        <el-carousel :style='{"width":"540px","margin":"0 0px 0 0","float":"right","height":"400px"}' trigger="click"
                     indicator-position="inside" arrow="always" type="default" direction="horizontal" height="400px"
                     autoplay="true" interval="3000" loop="true">
          <el-carousel-item :style='{"borderRadius":"10px","width":"100%","height":"100%"}' v-for="item in detailBanner"
                            :key="item.id">
            <el-image :style='{"objectFit":"cover","width":"100%","height":"100%"}' v-if="item.substr(0,4)=='http'"
                      :src="item" fit="cover" class="image"></el-image>
            <el-image :style='{"objectFit":"cover","width":"100%","height":"100%"}' v-else :src="baseUrl + item"
                      fit="cover" class="image"></el-image>
          </el-carousel-item>
        </el-carousel>


        <div class="info"
             :style='{"minHeight":"520px","width":"600px","padding":"0px 0 20px","margin":"0px","float":"left","background":"#fff"}'>
          <div class="item"
               :style='{"border":"0px solid #eee","padding":"10px 10px","boxShadow":"1px 2px 6px #8dd2eb","margin":"0 0 10px 0","alignItems":"center","borderRadius":"8px","background":"radial-gradient(circle, rgba(55,170,250,1) 25%, rgba(63,94,251,1) 100%),rgb(63,201,251)","display":"flex","justifyContent":"space-between"}'>
            <div :style='{"color":"#fff","fontSize":"16px"}'>
              {{ detail.kechengmingcheng }}
            </div>
            <div @click="storeup(1)" v-show="!isStoreup"
                 :style='{"cursor":"pointer","padding":"0","borderRadius":"30%","background":"none"}'><i v-if="true"
                                                                                                         :style='{"color":"#ffb966","fontSize":"14px"}'
                                                                                                         class="el-icon-star-off"></i><span
                :style='{"color":"#ffb966","fontSize":"14px"}'>点我收藏</span></div>
            <div @click="storeup(-1)" v-show="isStoreup"
                 :style='{"cursor":"pointer","padding":"0","borderRadius":"30%","background":"none"}'><i v-if="true"
                                                                                                         :style='{"color":"#ffb966","fontSize":"14px"}'
                                                                                                         class="el-icon-star-on"></i><span
                :style='{"color":"#ffb966","fontSize":"14px"}'>取消收藏</span></div>
          </div>

          <div class="item"
               :style='{"border":"1px solid #dfdfdf","padding":"0px 10px","boxShadow":"1px 2px 3px #eee","margin":"0 0 8px 0","borderRadius":"8px","background":"radial-gradient(circle, rgba(246,246,246,1) 0%, rgba(230,230,230,1) 100%)","display":"flex","justifyContent":"spaceBetween"}'>
            <div class="lable"
                 :style='{"width":"120px","padding":"0 10px","fontSize":"14px","lineHeight":"40px","color":"#666","textAlign":"right"}'>
              课程类型
            </div>
            <div
                :style='{"width":"498px","padding":"8px 10px 0","fontSize":"14px","lineHeight":"24px","color":"#999","height":"auto"}'>
              {{ detail.kechengleixing }}
            </div>
          </div>
          <div class="item"
               :style='{"border":"1px solid #dfdfdf","padding":"0px 10px","boxShadow":"1px 2px 3px #eee","margin":"0 0 8px 0","borderRadius":"8px","background":"radial-gradient(circle, rgba(246,246,246,1) 0%, rgba(230,230,230,1) 100%)","display":"flex","justifyContent":"spaceBetween"}'>
            <div class="lable"
                 :style='{"width":"120px","padding":"0 10px","fontSize":"14px","lineHeight":"40px","color":"#666","textAlign":"right"}'>
              班级名称
            </div>
            <div
                :style='{"width":"498px","padding":"8px 10px 0","fontSize":"14px","lineHeight":"24px","color":"#999","height":"auto"}'>
              {{ detail.banjimingcheng }}
            </div>
          </div>
          <div class="item"
               :style='{"border":"1px solid #dfdfdf","padding":"0px 10px","boxShadow":"1px 2px 3px #eee","margin":"0 0 8px 0","borderRadius":"8px","background":"radial-gradient(circle, rgba(246,246,246,1) 0%, rgba(230,230,230,1) 100%)","display":"flex","justifyContent":"spaceBetween"}'>
            <div class="lable"
                 :style='{"width":"120px","padding":"0 10px","fontSize":"14px","lineHeight":"40px","color":"#666","textAlign":"right"}'>
              课程时间
            </div>
            <div
                :style='{"width":"498px","padding":"8px 10px 0","fontSize":"14px","lineHeight":"24px","color":"#999","height":"auto"}'>
              {{ detail.kechengshijian }}
            </div>
          </div>
          <div class="item"
               :style='{"border":"1px solid #dfdfdf","padding":"0px 10px","boxShadow":"1px 2px 3px #eee","margin":"0 0 8px 0","borderRadius":"8px","background":"radial-gradient(circle, rgba(246,246,246,1) 0%, rgba(230,230,230,1) 100%)","display":"flex","justifyContent":"spaceBetween"}'>
            <div class="lable"
                 :style='{"width":"120px","padding":"0 10px","fontSize":"14px","lineHeight":"40px","color":"#666","textAlign":"right"}'>
              课程地点
            </div>
            <div
                :style='{"width":"498px","padding":"8px 10px 0","fontSize":"14px","lineHeight":"24px","color":"#999","height":"auto"}'>
              {{ detail.kechengdidian }}
            </div>
          </div>
          <div class="item"
               :style='{"border":"1px solid #dfdfdf","padding":"0px 10px","boxShadow":"1px 2px 3px #eee","margin":"0 0 8px 0","borderRadius":"8px","background":"radial-gradient(circle, rgba(246,246,246,1) 0%, rgba(230,230,230,1) 100%)","display":"flex","justifyContent":"spaceBetween"}'>
            <div class="lable"
                 :style='{"width":"120px","padding":"0 10px","fontSize":"14px","lineHeight":"40px","color":"#666","textAlign":"right"}'>
              课程目录
            </div>
            <div
                :style='{"width":"498px","padding":"8px 10px 0","fontSize":"14px","lineHeight":"24px","color":"#999","height":"auto"}'>
              {{ detail.kechengmulu }}
            </div>
          </div>
          <div class="item"
               :style='{"border":"1px solid #dfdfdf","padding":"0px 10px","boxShadow":"1px 2px 3px #eee","margin":"0 0 8px 0","borderRadius":"8px","background":"radial-gradient(circle, rgba(246,246,246,1) 0%, rgba(230,230,230,1) 100%)","display":"flex","justifyContent":"spaceBetween"}'>
            <div class="lable"
                 :style='{"width":"120px","padding":"0 10px","fontSize":"14px","lineHeight":"40px","color":"#666","textAlign":"right"}'>
              工号
            </div>
            <div
                :style='{"width":"498px","padding":"8px 10px 0","fontSize":"14px","lineHeight":"24px","color":"#999","height":"auto"}'>
              {{ detail.gonghao }}
            </div>
          </div>
          <div class="item"
               :style='{"border":"1px solid #dfdfdf","padding":"0px 10px","boxShadow":"1px 2px 3px #eee","margin":"0 0 8px 0","borderRadius":"8px","background":"radial-gradient(circle, rgba(246,246,246,1) 0%, rgba(230,230,230,1) 100%)","display":"flex","justifyContent":"spaceBetween"}'>
            <div class="lable"
                 :style='{"width":"120px","padding":"0 10px","fontSize":"14px","lineHeight":"40px","color":"#666","textAlign":"right"}'>
              教师姓名
            </div>
            <div
                :style='{"width":"498px","padding":"8px 10px 0","fontSize":"14px","lineHeight":"24px","color":"#999","height":"auto"}'>
              {{ detail.jiaoshixingming }}
            </div>
          </div>
          <div class="btn" :style='{"padding":"10px 0","flexWrap":"wrap","display":"flex"}'>
            <el-button
                :style='{"border":"0","cursor":"pointer","padding":"0 10px","margin":"0 5px 0 0","outline":"none","color":"#fff","borderRadius":"4px","background":"rgba(64, 158, 255, 1)","width":"auto","lineHeight":"40px","fontSize":"14px","height":"40px"}'
                v-if="isAuth('kechengxinxi','参加')" @click="onAcross('canjiakecheng','是','[1]','已参加该课程!')"
                type="warning">参加
            </el-button>
            <el-button
                :style='{"border":"0","cursor":"pointer","padding":"0 10px","margin":"0 5px 0 0","outline":"none","color":"#fff","borderRadius":"4px","background":"rgba(64, 158, 255, 1)","width":"auto","lineHeight":"40px","fontSize":"14px","height":"40px"}'
                v-if="isAuth('kechengxinxi','学习')" @click="onAcross('xuexijilu','是','','')" type="warning">学习
            </el-button>
            <el-button
                :style='{"border":"0","cursor":"pointer","padding":"0 10px","margin":"0 5px 0 0","outline":"none","color":"#fff","borderRadius":"4px","background":"rgba(64, 158, 255, 1)","width":"auto","lineHeight":"40px","fontSize":"14px","height":"40px"}'
                v-if="isAuth('kechengxinxi','审核')" @click="onSH" type="warning">审核
            </el-button>
          </div>
        </div>

      </div>


      <el-tabs class="detail"
               :style='{"border":"1px solid #dfdfdf","minHeight":"350px","boxShadow":"1px 2px 3px #eee","padding":"16px","borderRadius":"16px","background":"#FFF"}'
               v-model="activeName" type="border-card">
        <el-tab-pane label="课程介绍" name="first">
          <div v-html="detail.kechengjieshao"></div>
        </el-tab-pane>
        <!--        <el-tab-pane label="评论" name="second">-->
        <!--          <el-form class="add comment" :style='{"padding":"0px","margin":"12px 0 20px"}' :model="form" :rules="rules"-->
        <!--                   ref="form">-->
        <!--            <el-form-item class="item"-->
        <!--                          :style='{"border":"1px solid #ccc","boxShadow":"inset 0px 0px 28px 0px #eee","borderRadius":"8px","background":"#fff","display":"flex","width":"100%","height":"auto"}'-->
        <!--                          label="评论" prop="content">-->
        <!--              <el-input type="textarea" :rows="5" v-model="form.content" placeholder="请输入内容"></el-input>-->
        <!--            </el-form-item>-->
        <!--            <el-form-item class="btn"-->
        <!--                          :style='{"width":"100%","padding":"0 0 0 20px","margin":"10px 0 0","height":"auto"}'>-->
        <!--              <el-button-->
        <!--                  :style='{"border":"0","cursor":"pointer","padding":"0","boxShadow":"1px 2px 6px #52a1db","margin":"0 20px 0 0","color":"rgba(255, 255, 255, 1)","outline":"none","borderRadius":"30%","background":"radial-gradient(circle, rgba(128,184,246,1) 0%, rgba(36,153,251,1) 100%)","width":"128px","lineHeight":"40px","fontSize":"14px","height":"40px"}'-->
        <!--                  type="primary" @click="submitForm('form')">立即提交-->
        <!--              </el-button>-->
        <!--              <el-button-->
        <!--                  :style='{"border":"1px solid #bbb","cursor":"pointer","padding":"0","boxShadow":"1px 2px 6px #ccc","margin":"0 20px 0 0","color":"#999","outline":"none","borderRadius":"30%","background":"#fff","width":"128px","lineHeight":"40px","fontSize":"14px","height":"40px"}'-->
        <!--                  @click="resetForm('form')">重置-->
        <!--              </el-button>-->
        <!--            </el-form-item>-->
        <!--          </el-form>-->

        <!--          <div v-if="infoList.length" :style='{"boxShadow":"0 0px 0px 0 rgba(0, 0, 0, .1)","padding":"15px"}'-->
        <!--               class="comment">-->
        <!--            <div-->
        <!--                :style='{"padding":"0px 0","margin":"0 0 8px","borderColor":"#bbb","alignItems":"center","borderWidth":"0 0 1px 0","width":"100%","borderStyle":"dotted","height":"auto"}'-->
        <!--                v-for="item in infoList" :key="item.id">-->
        <!--              <div class="user" :style='{"width":"100%","alignItems":"center","display":"flex","height":"auto"}'>-->
        <!--                <el-image v-if="item.avatarurl"-->
        <!--                          :style='{"width":"40px","margin":"0 10px 0 0","borderRadius":"100%","objectFit":"cover","height":"40px"}'-->
        <!--                          :size="50" :src="baseUrl + item.avatarurl"></el-image>-->
        <!--                <el-image v-if="!item.avatarurl"-->
        <!--                          :style='{"width":"40px","margin":"0 10px 0 0","borderRadius":"100%","objectFit":"cover","height":"40px"}'-->
        <!--                          :size="50" :src="require('@/assets/touxiang.png')"></el-image>-->
        <!--                <div :style='{"color":"#333","fontSize":"16px"}' class="name">{{ item.nickname }}</div>-->
        <!--              </div>-->
        <!--              <div-->
        <!--                  :style='{"padding":"8px","margin":"8px 0px 0px","color":"#666","borderRadius":"4px","background":"none","lineHeight":"24px","fontSize":"14px","textIndent":"2em"}'-->
        <!--                  class="content-block-ask">-->
        <!--                {{ item.content }}-->
        <!--              </div>-->
        <!--              <div-->
        <!--                  :style='{"padding":"8px","margin":"8px 0px 0px","color":"#666","borderRadius":"4px","background":"none","lineHeight":"24px","fontSize":"14px","textIndent":"2em"}'-->
        <!--                  class="content-block-reply" v-if="item.reply">-->
        <!--                回复：{{ item.reply }}-->
        <!--              </div>-->
        <!--            </div>-->
        <!--          </div>-->

        <!--          <el-pagination-->
        <!--              background-->
        <!--              class="pagination"-->
        <!--              :pager-count="7"-->
        <!--              :page-size="pageSize"-->
        <!--              :page-sizes="pageSizes"-->
        <!--              prev-text="<"-->
        <!--              next-text=">"-->
        <!--              :hide-on-single-page="true"-->
        <!--              :layout='["total","prev","pager","next","sizes","jumper"].join()'-->
        <!--              :total="total"-->
        <!--              :style='{"padding":"0","margin":"10px auto","whiteSpace":"nowrap","color":"#333","width":"1200px","fontWeight":"500","order":"4"}'-->
        <!--              @current-change="curChange"-->
        <!--              @prev-click="prevClick"-->
        <!--              @next-click="nextClick"-->
        <!--          ></el-pagination>-->
        <!--        </el-tab-pane>-->

        <el-tab-pane label="视频" name="third" v-if="detail2">
          <div v-html="detail2.shipinjieshao"></div>
          <div>
            <div class="video-span">
              <div style="margin: 10px" v-for="(item,index) in detail2.kechengshipin.split(',')">
                <el-button @click="changeClickVideo(item)">课程视频{{ index + 1 }}</el-button>
              </div>
              <div style="margin: 10px">
                <el-button type="success" @click="onAcross('xuexijilu','是','','')">提交学习时长</el-button>
              </div>
            </div>
            <video
                id="myvideo"
                ref="video" @play="onPlay" @pause="onPause"
                :style='{"border":"1px solid #dfdfdf","padding":"20px 200px","boxShadow":"1px 2px 3px #eee","margin":"10px auto","outline":"none","borderRadius":"16px","background":"#fff","display":"block","width":"100%"}'
                :src="clickVideo" controls="controls" @canplay="getVidDur()">
              您的浏览器不支持视频播放
            </video>
          </div>
        </el-tab-pane>

        <!--        <el-tab-pane label="评论" name="four">-->
        <!--          <el-form class="add comment" :style='{"padding":"0px","margin":"12px 0 20px"}' :model="form" :rules="rules"-->
        <!--                   ref="form">-->
        <!--            <el-form-item class="item"-->
        <!--                          :style='{"border":"1px solid #ccc","boxShadow":"inset 0px 0px 28px 0px #eee","borderRadius":"8px","background":"#fff","display":"flex","width":"100%","height":"auto"}'-->
        <!--                          label="评论" prop="content">-->
        <!--              <el-input type="textarea" :rows="5" v-model="form.content" placeholder="请输入内容"></el-input>-->
        <!--            </el-form-item>-->
        <!--            <el-form-item class="btn"-->
        <!--                          :style='{"width":"100%","padding":"0 0 0 20px","margin":"10px 0 0","height":"auto"}'>-->
        <!--              <el-button-->
        <!--                  :style='{"border":"0","cursor":"pointer","padding":"0","boxShadow":"1px 2px 6px #52a1db","margin":"0 20px 0 0","color":"rgba(255, 255, 255, 1)","outline":"none","borderRadius":"30%","background":"radial-gradient(circle, rgba(128,184,246,1) 0%, rgba(36,153,251,1) 100%)","width":"128px","lineHeight":"40px","fontSize":"14px","height":"40px"}'-->
        <!--                  type="primary" @click="submitForm('form')">立即提交-->
        <!--              </el-button>-->
        <!--              <el-button-->
        <!--                  :style='{"border":"1px solid #bbb","cursor":"pointer","padding":"0","boxShadow":"1px 2px 6px #ccc","margin":"0 20px 0 0","color":"#999","outline":"none","borderRadius":"30%","background":"#fff","width":"128px","lineHeight":"40px","fontSize":"14px","height":"40px"}'-->
        <!--                  @click="resetForm('form')">重置-->
        <!--              </el-button>-->
        <!--            </el-form-item>-->
        <!--          </el-form>-->

        <!--          <div v-if="infoList.length" :style='{"boxShadow":"0 0px 0px 0 rgba(0, 0, 0, .1)","padding":"15px"}'-->
        <!--               class="comment">-->
        <!--            <div-->
        <!--                :style='{"padding":"0px 0","margin":"0 0 8px","borderColor":"#bbb","alignItems":"center","borderWidth":"0 0 1px 0","width":"100%","borderStyle":"dotted","height":"auto"}'-->
        <!--                v-for="item in infoList" :key="item.id">-->
        <!--              <div class="user" :style='{"width":"100%","alignItems":"center","display":"flex","height":"auto"}'>-->
        <!--                <el-image v-if="item.avatarurl"-->
        <!--                          :style='{"width":"40px","margin":"0 10px 0 0","borderRadius":"100%","objectFit":"cover","height":"40px"}'-->
        <!--                          :size="50" :src="baseUrl + item.avatarurl"></el-image>-->
        <!--                <el-image v-if="!item.avatarurl"-->
        <!--                          :style='{"width":"40px","margin":"0 10px 0 0","borderRadius":"100%","objectFit":"cover","height":"40px"}'-->
        <!--                          :size="50" :src="require('@/assets/touxiang.png')"></el-image>-->
        <!--                <div :style='{"color":"#333","fontSize":"16px"}' class="name">{{ item.nickname }}</div>-->
        <!--              </div>-->
        <!--              <div-->
        <!--                  :style='{"padding":"8px","margin":"8px 0px 0px","color":"#666","borderRadius":"4px","background":"none","lineHeight":"24px","fontSize":"14px","textIndent":"2em"}'-->
        <!--                  class="content-block-ask">-->
        <!--                {{ item.content }}-->
        <!--              </div>-->
        <!--              <div-->
        <!--                  :style='{"padding":"8px","margin":"8px 0px 0px","color":"#666","borderRadius":"4px","background":"none","lineHeight":"24px","fontSize":"14px","textIndent":"2em"}'-->
        <!--                  class="content-block-reply" v-if="item.reply">-->
        <!--                回复：{{ item.reply }}-->
        <!--              </div>-->
        <!--            </div>-->
        <!--          </div>-->

        <!--          <el-pagination-->
        <!--              background-->
        <!--              class="pagination"-->
        <!--              :pager-count="7"-->
        <!--              :page-size="pageSize"-->
        <!--              :page-sizes="pageSizes"-->
        <!--              prev-text="<"-->
        <!--              next-text=">"-->
        <!--              :hide-on-single-page="true"-->
        <!--              :layout='["total","prev","pager","next","sizes","jumper"].join()'-->
        <!--              :total="total"-->
        <!--              :style='{"padding":"0","margin":"10px auto","whiteSpace":"nowrap","color":"#333","width":"1200px","fontWeight":"500","order":"4"}'-->
        <!--              @current-change="curChange"-->
        <!--              @prev-click="prevClick"-->
        <!--              @next-click="nextClick"-->
        <!--          ></el-pagination>-->
        <!--        </el-tab-pane>-->


        <el-tab-pane label="测试" name="five">
          <el-table
              :data="tableData"
              style="width: 100%">
            <el-table-column
                label="测试名称"
                prop="name">
            </el-table-column>
            <el-table-column
                label="测试时长">
              <template slot-scope="scope">
                {{ scope.row.time }}分钟
              </template>
            </el-table-column>
            <el-table-column
                label="创建时间"
                prop="addtime">
            </el-table-column>
            <el-table-column label="操作" width="150">
              <template slot-scope="scope">
                <el-button
                    type="success"
                    size="mini"
                    @click="handleExam2(scope.$index, scope.row)">测试
                </el-button>
              </template>
            </el-table-column>
          </el-table>

          <el-pagination
              background
              class="pagination"
              :pager-count="7"
              :page-size="pageSize"
              :page-sizes="pageSizes"
              prev-text="<"
              next-text=">"
              :hide-on-single-page="true"
              :layout='["total","prev","pager","next","sizes","jumper"].join()'
              :total="total"
              :style='{"padding":"0","margin":"10px auto","whiteSpace":"nowrap","color":"#333","width":"1200px","fontWeight":"500","order":"4"}'
              @current-change="curChange2"
              @prev-click="prevClick2"
              @next-click="nextClick2"
          ></el-pagination>
        </el-tab-pane>

        <el-tab-pane label="讨论" name="six">
          <list></list>
        </el-tab-pane>

      </el-tabs>
      <el-dialog title="审核" :visible.sync="sfshVisiable" width="50%">
        <el-form ref="shForm" :model="shForm" label-width="80px">
          <el-form-item label="审核状态">
            <el-select v-model="shForm.sfsh" placeholder="审核状态">
              <el-option label="通过" value="是"></el-option>
              <el-option label="不通过" value="否"></el-option>
              <el-option label="待审核" value="待审核"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="内容">
            <el-input type="textarea" :rows="8" v-model="shForm.shhf"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="sfshVisiable = false">取 消</el-button>
          <el-button type="primary" @click="shHandler">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import CountDown from '@/components/CountDown';
import List from '@/pages/forum/list';

var video = () => {
  var videoTime = document.getElementById("myvideo");
  //console.log(videoTime.duration); //获取视频时长
  //console.log(videoTime.currentTime); //获取视频当前播放时间
};
export default {
  //数据集合
  data() {
    return {
      clickVideo: "",
      tablename: 'kechengxinxi',
      tableData: [],
      totalExam: 1,
      pageSizeExam: 5,
      pageSizesExam: [10, 20, 30, 50],
      totalPageExam: 1,
      baseUrl: '',
      breadcrumbItem: [
        {
          name: '详情信息'
        }
      ],
      title: '',
      detailBanner: [],
      endTime: 0,
      detail: {},
      detail2: {},
      activeName: 'first',
      form: {
        content: '',
        userid: localStorage.getItem('userid'),
        nickname: localStorage.getItem('username'),
        avatarurl: '',
      },
      infoList: [],
      total: 1,
      pageSize: 5,
      pageSizes: [10, 20, 30, 50],
      totalPage: 1,
      rules: {
        content: [
          {required: true, message: '请输入内容', trigger: 'blur'}
        ]
      },
      storeupParams: {
        name: '',
        picture: '',
        refid: 0,
        tablename: 'kechengxinxi',
        userid: localStorage.getItem('userid')
      },
      isStoreup: false,
      storeupInfo: {},
      buynumber: 1,
      sfshVisiable: false,
      shForm: {
        sfsh: '是',
        shhf: ''
      },
      totalTime: 0,
      timeInterval: null,
      playing: false
    }
  },
  created() {
    this.init();
    this.init2();
    this.getExamList(1);
  },
  mounted() {
    this.timeInterval = setInterval(() => {
      if (this.playing) {
        this.$store.commit('video/setVideo');
        //console.log(this.$store.state.video.timeCount)
      }
    }, 1000);
  },
  beforeDestroy() {
    clearInterval(this.timeInterval);

  },
  //方法集合
  methods: {
    // goto() {
    //   this.$router.push("/index/xuexijiluAdd?type=cross")
    // },
    getVidDur() {
      video();
    },
    changeClickVideo(item) {
      this.clickVideo = this.$config.baseUrl + item;
    },
    onPlay() {
      this.playing = true;
    },
    onPause() {
      this.playing = false;
    },
    getExamList(page) {
      let detail = JSON.parse(this.$route.query.detailObj);
      this.$http.get('exampaper/list', {
        params: {
          page,
          limit: this.pageSize,
          status: 1,
          kechengmingcheng: detail.kechengmingcheng,
          gonghao:detail.gonghao
        }
      }).then(res => {
        if (res.data.code == 0) {
          this.tableData = res.data.data.list;
          this.totalExam = res.data.data.total;
          this.pageSizeExam = res.data.data.pageSize;
          this.totalPageExam = res.data.data.totalPage;
          this.pageSizesExam = [this.pageSizesExam, this.pageSizesExam * 2, this.pageSize * 3, this.pageSize * 5];
        }
      });
    },

    curChange2(page) {
      this.getExamList(page);
    },
    prevClick2(page) {
      this.getExamList(page);
    },
    nextClick2(page) {
      this.getExamList(page);
    },
    handleExam2(index, row) {
      this.$router.push({path: '/exam', query: {id: row.id, time: row.time}})
    },
    init() {
      this.baseUrl = this.$config.baseUrl;
      if (this.$route.query.detailObj) {
        this.detail = JSON.parse(this.$route.query.detailObj);
      }
      if (this.$route.query.storeupObj) {
        this.detail.id = JSON.parse(this.$route.query.storeupObj).refid;
      }
      this.$http.get(this.tablename + '/detail/' + this.detail.id, {}).then(res => {
        if (res.data.code == 0) {
          this.detail = res.data.data;
          this.title = this.detail.kechengmingcheng;
          this.detailBanner = this.detail.tupian ? this.detail.tupian.split(",") : [];
          this.$forceUpdate();
        }
      });

      this.getDiscussList(1);
      this.getStoreupStatus();

    },

    init2() {
      this.baseUrl = this.$config.baseUrl;
      if (this.$route.query.detailObj) {
        this.detail = JSON.parse(this.$route.query.detailObj);
      }
      if (this.$route.query.storeupObj) {
        this.detail.id = JSON.parse(this.$route.query.storeupObj).refid;
      }
      this.$http.get("kechengshipin" + '/detail2/' + this.detail.kechengmingcheng, {}).then(res => {
        if (res.data.code == 0) {
          this.detail2 = res.data.data;
          this.clickVideo = this.$config.baseUrl + this.detail2.kechengshipin.split(",")[0]
          this.$forceUpdate();
        } else {
          this.detail2 = null
          this.$forceUpdate();
          this.$message(res.data.msg)
        }
      })

      this.getDiscussList(1);
      this.getStoreupStatus();

    },
    onAcross(acrossTable, crossOptAudit, statusColumnName, tips, statusColumnValue) {
      localStorage.setItem('crossTable', `kechengxinxi`);
      localStorage.setItem('crossObj', JSON.stringify(this.detail));
      localStorage.setItem('statusColumnName', statusColumnName);
      localStorage.setItem('statusColumnValue', statusColumnValue);
      localStorage.setItem('tips', tips);
      if (statusColumnName != '' && !statusColumnName.startsWith("[")) {
        var obj = JSON.parse(localStorage.getItem('crossObj'));
        for (var o in obj) {
          if (o == statusColumnName && obj[o] == statusColumnValue) {
            this.$message({
              type: 'success',
              message: tips,
              duration: 1500
            });
            return
          }
        }
      }
      this.$router.push({path: '/index/' + acrossTable + 'Add', query: {type: 'cross'}});
    },
    onSH() {
      this.sfshVisiable = true;
    },
    shHandler() {
      this.$confirm(`确定操作?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.detail.sfsh = this.shForm.sfsh;
        this.detail.shhf = this.shForm.shhf;
        this.$http.post(`${this.tablename}/update`, this.detail).then(res => {
          if (res.data.code == 0) {
            this.sfshVisiable = false;
            this.$message({
              message: "操作成功",
              type: "success",
              duration: 1500,
            });
          }
        });
      });
    },
    storeup(type) {
      if (type == 1 && !this.isStoreup) {
        this.storeupParams.name = this.title;
        this.storeupParams.picture = this.detailBanner[0];
        this.storeupParams.inteltype = this.detail.kechengleixing;
        this.storeupParams.refid = this.detail.id;
        this.storeupParams.type = type;
        this.$http.post('storeup/add', this.storeupParams).then(res => {
          if (res.data.code == 0) {
            this.isStoreup = true;
            this.$message({
              type: 'success',
              message: '收藏成功!',
              duration: 1500,
            });
          }
        });
      }
      if (type == -1 && this.isStoreup) {
        this.$http.get('storeup/list', {
          params: {
            page: 1,
            limit: 1,
            type: 1,
            refid: this.detail.id,
            tablename: 'kechengxinxi',
            userid: localStorage.getItem('userid')
          }
        }).then(res => {
          if (res.data.code == 0 && res.data.data.list.length > 0) {
            this.isStoreup = true;
            this.storeupInfo = res.data.data.list[0];
            let delIds = new Array();
            delIds.push(this.storeupInfo.id);
            this.$http.post('storeup/delete', delIds).then(res => {
              if (res.data.code == 0) {
                this.isStoreup = false;
                this.$message({
                  type: 'success',
                  message: '取消成功!',
                  duration: 1500,
                });
              }
            });
          }
        });
      }
    },
    getStoreupStatus() {
      if (localStorage.getItem("Token")) {
        this.$http.get('storeup/list', {
          params: {
            page: 1,
            limit: 1,
            type: 1,
            refid: this.detail.id,
            tablename: 'kechengxinxi',
            userid: localStorage.getItem('userid')
          }
        }).then(res => {
          if (res.data.code == 0 && res.data.data.list.length > 0) {
            this.isStoreup = true;
            this.storeupInfo = res.data.data.list[0];
          }
        });
      }
    },
    curChange(page) {
      this.getDiscussList(page);
    },
    prevClick(page) {
      this.getDiscussList(page);
    },
    nextClick(page) {
      this.getDiscussList(page);
    },
    // 下载
    download(file) {
      if (!file) {
        this.$message({
          type: 'error',
          message: '文件不存在',
          duration: 1500,
        });
        return;
      }
      window.open(this.baseUrl + file)
    },
    getDiscussList(page) {
      this.$http.get('discusskechengshipin/list', {
        params: {
          page,
          limit: this.pageSize,
          refid: this.detail2.id
        }
      }).then(res => {
        if (res.data.code == 0) {
          this.infoList = res.data.data.list;
          this.total = res.data.data.total;
          this.pageSize = res.data.data.pageSize;
          this.pageSizes = [this.pageSize, this.pageSize * 2, this.pageSize * 3, this.pageSize * 5];
          this.totalPage = res.data.data.totalPage;
        }
      });
    },
    submitForm(formName) {
      let sensitiveWords = "";
      let sensitiveWordsArr = [];
      if (sensitiveWords) {
        sensitiveWordsArr = sensitiveWords.split(",");
      }
      for (var i = 0; i < sensitiveWordsArr.length; i++) {
        //全局替换
        var reg = new RegExp(sensitiveWordsArr[i], "g");
        //判断内容中是否包括敏感词
        if (this.form.content.indexOf(sensitiveWordsArr[i]) > -1) {
          // 将敏感词替换为 **
          this.form.content = this.form.content.replace(reg, "**");
        }
      }
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.form.refid = this.detail2.id;
          this.form.avatarurl = localStorage.getItem('headportrait') ? localStorage.getItem('headportrait') : '';
          this.$http.post('discusskechengshipin/add', this.form).then(res => {
            if (res.data.code == 0) {
              this.form.content = '';
              this.getDiscussList(1);
              this.$message({
                type: 'success',
                message: '评论成功!',
                duration: 1500,
              });
            }
          });
        } else {
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },


  },
  components: {
    CountDown,
    List
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

.video-span {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
}

.detail-preview {

  .attr {
    .el-carousel /deep/ .el-carousel__indicator button {
      width: 0;
      height: 0;
      display: none;
    }

    .el-input-number__decrease:hover:not(.is-disabled) ~ .el-input .el-input__inner:not(.is-disabled), .el-input-number__increase:hover:not(.is-disabled) ~ .el-input .el-input__inner:not(.is-disabled) {
      border-color: none;
    }
  }

  .detail {
    & /deep/ .el-tabs__header .el-tabs__nav-wrap {
      margin-bottom: 0;
    }

    & .add .el-textarea {
      width: auto;
    }
  }
}

.attr .el-carousel /deep/ .el-carousel__container .el-carousel__arrow--left {
  width: 36px;
  font-size: 12px;
  height: 36px;
}

.attr .el-carousel /deep/ .el-carousel__container .el-carousel__arrow--left:hover {
  background: #278bd5;
}

.attr .el-carousel /deep/ .el-carousel__container .el-carousel__arrow--right {
  width: 36px;
  font-size: 12px;
  height: 36px;
}

.attr .el-carousel /deep/ .el-carousel__container .el-carousel__arrow--right:hover {
  background: #278bd5;
}

.attr .el-carousel /deep/ .el-carousel__indicators {
  padding: 0;
  margin: 0 0 8px 0;
  z-index: 2;
  position: absolute;
  list-style: none;
}

.attr .el-carousel /deep/ .el-carousel__indicators li {
  border-radius: 50%;
  padding: 0;
  margin: 0 4px;
  background: #fff;
  display: inline-block;
  width: 12px;
  opacity: 0.4;
  transition: 0.3s;
  height: 12px;
}

.attr .el-carousel /deep/ .el-carousel__indicators li:hover {
  border-radius: 50%;
  padding: 0;
  margin: 0 4px;
  background: #fff;
  display: inline-block;
  width: 12px;
  opacity: 0.7;
  height: 12px;
}

.attr .el-carousel /deep/ .el-carousel__indicators li.is-active {
  border-radius: 50%;
  padding: 0;
  margin: 0 4px;
  background: #fff;
  display: inline-block;
  width: 12px;
  opacity: 1;
  height: 12px;
}

.attr .el-input-number /deep/ .el-input-number__decrease {
  cursor: pointer;
  z-index: 1;
  display: flex;
  border-color: #DCDFE6;
  border-radius: 4px 0 0 4px;
  top: 1px;
  left: 1px;
  background: #f5f5f5;
  width: 40px;
  justify-content: center;
  border-width: 0 1px 0 0;
  align-items: center;
  position: absolute;
  border-style: solid;
  text-align: center;
  height: 38px;
}

.attr .el-input-number /deep/ .el-input-number__decrease i {
  color: #666;
  font-size: 14px;
}

.attr .el-input-number /deep/ .el-input-number__increase {
  cursor: pointer;
  z-index: 1;
  display: flex;
  border-color: #DCDFE6;
  right: 1px;
  border-radius: 0 4px 4px 0;
  top: 1px;
  background: #f5f5f5;
  width: 40px;
  justify-content: center;
  border-width: 0 0 0 1px;
  align-items: center;
  position: absolute;
  border-style: solid;
  text-align: center;
  height: 38px;
}

.attr .el-input-number /deep/ .el-input-number__increase i {
  color: #666;
  font-size: 14px;
}

.attr .el-input-number /deep/ .el-input .el-input__inner {
  border: 1px solid #DCDFE6;
  border-radius: 4px;
  padding: 0 40px;
  outline: none;
  color: #666;
  background: #FFF;
  display: inline-block;
  width: 100%;
  font-size: 14px;
  line-height: 40px;
  text-align: center;
  height: 40px;
}

.detail-preview .detail.el-tabs /deep/ .el-tabs__header {
  border-radius: 8px;
  padding: 4px 6px;
  margin: 0;
  background: radial-gradient(circle, rgba(63, 201, 251, 1) 50%, rgba(63, 94, 251, 1) 100%), rgb(63, 201, 251);
  border-color: #E4E7ED;
  border-width: 0 0 0px 0;
  border-style: solid;
}

.detail-preview .detail.el-tabs /deep/ .el-tabs__header .el-tabs__item {
  border: 0;
  padding: 0 16px;
  margin: 0 4px 0 4px;
  color: #fff;
  font-weight: 500;
  display: inline-block;
  font-size: 14px;
  line-height: 32px;
  border-radius: 50%;
  background: transparent;
  position: relative;
  list-style: none;
  height: 32px;
}

.detail-preview .detail.el-tabs /deep/ .el-tabs__header .el-tabs__item:hover {
  border: 0;
  border-radius: 50%;
  padding: 0 16px;
  margin: 0 4px 0 4px;
  color: #409EFF;
  background: #f3f9fe;
  line-height: 32px;
  height: 32px;
}

.detail-preview .detail.el-tabs /deep/ .el-tabs__header .el-tabs__item.is-active {
  border: 0;
  border-radius: 50%;
  padding: 0 16px;
  margin: 0 4px 0 4px;
  color: #409EFF;
  background: #f3f9fe;
  line-height: 32px;
  height: 32px;
}

.detail-preview .detail.el-tabs /deep/ .el-tabs__content {
  padding: 15px;
}

.detail-preview .detail.el-tabs .add /deep/ .el-form-item__label {
  padding: 0 10px 0 0;
  color: #666;
  width: 80px;
  font-size: 14px;
  line-height: 40px;
  text-align: right;
}

.detail-preview .detail.el-tabs .add /deep/ .el-textarea__inner {
  border: 0;
  border-radius: 4px;
  padding: 4px 12px;
  box-shadow: 0 0 0px rgba(64, 158, 255, .5);
  outline: none;
  color: #333;
  background: none;
  width: 1058px;
  font-size: 14px;
  min-height: 200px;
  line-height: 32px;
  height: 200px;
}

.breadcrumb-preview .el-breadcrumb /deep/ .el-breadcrumb__separator {
  margin: 0 9px;
  color: #ccc;
  font-weight: 500;
}

.breadcrumb-preview .el-breadcrumb /deep/ .el-breadcrumb__inner a {
  color: #333;
  display: inline-block;
}

.breadcrumb-preview .el-breadcrumb /deep/ .el-breadcrumb__inner {
  color: #999;
  display: inline-block;
}

.el-pagination /deep/ .el-pagination__total {
  margin: 0 10px 0 0;
  color: #666;
  font-weight: 400;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  height: 28px;
}

.el-pagination /deep/ .btn-prev {
  border: none;
  border-radius: 2px;
  padding: 0;
  margin: 0 5px;
  color: #666;
  background: #f4f4f5;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  min-width: 35px;
  height: 28px;
}

.el-pagination /deep/ .btn-next {
  border: none;
  border-radius: 2px;
  padding: 0;
  margin: 0 5px;
  color: #666;
  background: #f4f4f5;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  min-width: 35px;
  height: 28px;
}

.el-pagination /deep/ .btn-prev:disabled {
  border: none;
  cursor: not-allowed;
  border-radius: 2px;
  padding: 0;
  margin: 0 5px;
  color: #C0C4CC;
  background: #f4f4f5;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  height: 28px;
}

.el-pagination /deep/ .btn-next:disabled {
  border: none;
  cursor: not-allowed;
  border-radius: 2px;
  padding: 0;
  margin: 0 5px;
  color: #C0C4CC;
  background: #f4f4f5;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  height: 28px;
}

.el-pagination /deep/ .el-pager {
  padding: 0;
  margin: 0;
  display: inline-block;
  vertical-align: top;
}

.el-pagination /deep/ .el-pager .number {
  cursor: pointer;
  padding: 0 4px;
  margin: 0 5px;
  color: #666;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  border-radius: 2px;
  background: #f4f4f5;
  text-align: center;
  min-width: 30px;
  height: 28px;
}

.el-pagination /deep/ .el-pager .number:hover {
  cursor: pointer;
  padding: 0 4px;
  margin: 0 5px;
  color: #409EFF;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  border-radius: 2px;
  background: #f4f4f5;
  text-align: center;
  min-width: 30px;
  height: 28px;
}

.el-pagination /deep/ .el-pager .number.active {
  cursor: default;
  padding: 0 4px;
  margin: 0 5px;
  color: #FFF;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  border-radius: 2px;
  background: #409EFF;
  text-align: center;
  min-width: 30px;
  height: 28px;
}

.el-pagination /deep/ .el-pagination__sizes {
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  height: 28px;
}

.el-pagination /deep/ .el-pagination__sizes .el-input {
  margin: 0 5px;
  width: 100px;
  position: relative;
}

.el-pagination /deep/ .el-pagination__sizes .el-input .el-input__inner {
  border: 1px solid #DCDFE6;
  cursor: pointer;
  padding: 0 25px 0 8px;
  color: #606266;
  display: inline-block;
  font-size: 13px;
  line-height: 28px;
  border-radius: 3px;
  outline: 0;
  background: #FFF;
  width: 100%;
  text-align: center;
  height: 28px;
}

.el-pagination /deep/ .el-pagination__sizes .el-input span.el-input__suffix {
  top: 0;
  position: absolute;
  right: 0;
  height: 100%;
}

.el-pagination /deep/ .el-pagination__sizes .el-input .el-input__suffix .el-select__caret {
  cursor: pointer;
  color: #C0C4CC;
  width: 25px;
  font-size: 14px;
  line-height: 28px;
  text-align: center;
}

.el-pagination /deep/ .el-pagination__jump {
  margin: 0 0 0 24px;
  color: #606266;
  display: inline-block;
  vertical-align: top;
  font-size: 13px;
  line-height: 28px;
  height: 28px;
}

.el-pagination /deep/ .el-pagination__jump .el-input {
  border-radius: 3px;
  padding: 0 2px;
  margin: 0 2px;
  display: inline-block;
  width: 50px;
  font-size: 14px;
  line-height: 18px;
  position: relative;
  text-align: center;
  height: 28px;
}

.el-pagination /deep/ .el-pagination__jump .el-input .el-input__inner {
  border: 1px solid #DCDFE6;
  cursor: pointer;
  padding: 0 3px;
  color: #606266;
  display: inline-block;
  font-size: 14px;
  line-height: 28px;
  border-radius: 3px;
  outline: 0;
  background: #FFF;
  width: 100%;
  text-align: center;
  height: 28px;
}
</style>
